<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改项目主合同')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: jasny-bootstrap-css" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
	<style>
		.file-preview {
		    padding: 0;
		    margin-bottom: 0;
		    border-radius: 0;
		    border: none;
		}
		
		.krajee-default.file-preview-frame {
		    margin-right: 20px;
		    padding: 0;
		    border: none;
		    box-shadow: none;
		}
		
		.krajee-default.file-preview-frame:not(.file-preview-error):hover {
		    border: none;
		    box-shadow: none;
		}
		
		.krajee-default .file-footer-caption {
			margin-bottom: 0;
		}
		
		.krajee-default.file-preview-frame .file-thumbnail-footer {
		    height: auto;
		}
		
		.krajee-default .file-caption-info {
			width: auto;
		}
		
		.kv-upload-progress .progress {
			margin-top: 0;
		}
		
		.krajee-default.file-preview-frame .kv-file-content,
		.krajee-default .file-size-info,
		.krajee-default .file-upload-indicator,
		.file-input .kv-file-upload,
		.file-input .kv-file-zoom {
			display: none;
		}
		
		.file-input .kv-file-remove {
			position: absolute;
			top: 3px;
			right: -15px;
			height: 14px;
			padding: 0;
			margin: 0;
			border: none;
			background: none;
		}
		
		.file-input .kv-file-remove:active, 
		.file-input .kv-file-remove:focus {
			background: none;
			outline: none;
			box-shadow: none;
		}
		
		.file-input .kv-file-remove .glyphicon-trash {
			color: red;
		}
	</style>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-contract-edit" th:object="${sjContract}">
            <input name="id" th:field="*{id}" type="hidden">
            <input type="hidden" id="zilwj" name="zilwj" th:field="*{zilwj}" />
            <input type="hidden" id="zilwjvo" name="zilwjvo" th:value="${zilwjvo}" />
            <input name="deptId" type="hidden" th:field="*{deptId}" >
            <input name="ownerId" type="hidden" th:field="*{ownerId}" >
            <input type="hidden" id="approvename" name="approvename" th:value="${approvename}" />
            <div class="form-group">
            	<label class="col-sm-1 control-label is-required">合同主体单位：</label>
            	<div class="col-sm-11">
            		<select name="ztdw" th:field="*{ztdw}" class="form-control" th:with="type=${@dict.getType('sj_gongs')}">
                    	<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                	</select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-1 control-label is-required">合同编号：</label>
                <div class="col-sm-3">
                    <input name="orderNo" th:field="*{orderNo}" class="form-control" type="text" autoComplete="off" required>
                </div>
                <label class="col-sm-1 control-label is-required">申报部门：</label>
                <div class="col-sm-3">
                    <input name="dept" th:field="*{dept}" class="form-control" type="text"  readonly="readonly" autoComplete="off" required>
                </div>
                <label class="col-sm-1 control-label is-required">申报人：</label>
                <div class="col-sm-3">
                    <input name="owner" th:field="*{owner}" class="form-control" type="text" readonly="readonly" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group">  
                <label class="col-sm-1 control-label is-required">申报类别：</label>
                <div class="col-sm-3">
                    <select name="type" th:field="*{type}" class="form-control" th:with="type=${@dict.getType('sj_contract_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
                <label class="col-sm-1 control-label is-required">项目名称：</label>
                <div class="col-sm-3">
                    <select id="gcProjectId" th:field="*{gcProjectId}" name="gcProjectId" class="form-control" >
						<option th:each="cl:${gplis}" th:value="${cl.id}" th:text="${cl.name}"></option>
					</select>
                </div>
                <label class="col-sm-1 control-label is-required">项目规模：<br>(平方米)</label>
                <div class="col-sm-3">
                    <input name="xmgm" th:field="*{xmgm}" class="form-control" type="text" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-1 control-label is-required">项目类型：</label>
                <div class="col-sm-3">
					<select name="proType" th:field="*{proType}" class="form-control" th:with="type=${@dict.getType('sj_proType')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
                <label class="col-sm-1 control-label is-required">合同金额(元)：</label>
                <div class="col-sm-3">
                    <input name="htje" th:field="*{htje}" class="form-control" type="text" autoComplete="off" required>
                </div>
                <label class="col-sm-1 control-label is-required">附件数：</label>
                <div class="col-sm-3">
                    <input name="fjs" th:field="*{fjs}" class="form-control" type="text" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group">    
	            <label class="col-sm-1 control-label is-required">项目所属：</label>
                <div class="col-sm-3">
                    <select name="authority" th:field="*{authority}" class="form-control" required>
						<option th:each="cl:${deptlis}" th:value="${cl.deptId}" th:text="${cl.deptName}"></option>
					</select>
                </div>
                <label class="col-sm-1 control-label ">合作联系人：</label>
                <div class="col-sm-3">
                    <input name="lxr" th:field="*{lxr}" class="form-control" type="text" autoComplete="off" >
                </div>
                <label class="col-sm-1 control-label ">合作联系电话：</label>
                <div class="col-sm-3">
                    <input name="lxrPhone" th:field="*{lxrPhone}" class="form-control" type="text" autoComplete="off" >
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-1 control-label is-required">工作内容：</label>
                <div class="col-sm-11">
                    <textarea name="descs" class="form-control" autoComplete="off" required>[[*{descs}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-1 control-label">合同文件：</label>
                <div class="col-sm-11" style="margin-top: 8px;" id="zlwjlink">
                </div>
            </div>
            <div class="form-group">
	            <label class="col-sm-1 control-label is-required">合同文件：</label>
	            <div class="col-sm-11">
	            	<div class="file-loading">
		            	<input id="multipleFile" name="files" type="file" multiple>
		        	</div>
	            </div>
            </div>
            <div class="form-group">
            	<label class="col-sm-1 control-label is-required">运营：</label>
                <div class="col-sm-3">
                	<div class="input-group">
                    	<input id="yyzxsh" th:field="*{yyzxsh}" class="form-control" type="hidden">
                    	<input id="yyzxshId" th:field="*{yyzxshId}" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel1()" id="yyzxshStr" th:value="*{yyzxsh}" readonly="true" required>
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
                <label class="col-sm-1 control-label is-required">申报部门审核：</label>
                <div class="col-sm-3">
                	<div class="input-group">
                    	<input id="sbbmsh" th:field="*{sbbmsh}" class="form-control" type="hidden">
                    	<input id="sbbmshId" nth:field="*{sbbmshId}" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel2()" id="sbbmshStr" th:value="*{sbbmsh}" readonly="true" required>
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
            	<label class="col-sm-1 control-label is-required">项目董事：</label>
                <div class="col-sm-3">
                	<div class="input-group">
                    	<input id="xmfzrsh" th:field="*{xmfzrsh}" class="form-control" type="hidden">
                    	<input id="xmfzrshId" th:field="*{xmfzrshId}" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel3()" id="xmfzrshStr" th:value="*{xmfzrsh}" readonly="true" required>
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-1 control-label is-required">会计：</label>
                <div class="col-sm-3">
                	<div class="input-group">
                    	<input id="hjsh" th:field="*{hjsh}" class="form-control" type="hidden">
                    	<input id="hjshId" th:field="*{hjshId}" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel4()" id="hjshStr" th:value="*{hjsh}" readonly="true" required>
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
            </div>
        </form>
    </div>
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
<!--             <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp; -->
            <button type="button" class="btn btn-sm btn-primary" onclick="addSubmitHandler()"><i class="fa fa-check"></i>提 交</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: jasny-bootstrap-js" />
    <script th:src="@{/ruoyi/base64.min.js?v=20231208}"></script>
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <th:block th:include="include :: bootstrap-suggest-js" />
    <th:block th:include="include :: bootstrap-typeahead-js" />
    <script th:inline="javascript">
        var prefix = ctx + "yy/contract";
        $("#form-contract-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/edit", $('#form-contract-edit').serialize());
            }
        }
        
        function addSubmitHandler() {
            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/editSubmit", $('#form-contract-edit').serialize());
            }
        }
        
        $(function() {
			var zilwj = $("#zilwjvo").val();
        	
        	var n=zilwj.split(",");
        	for(var i=0;i<n.length;i++){
//         		var url = "http://lkgnews.cn:8012/onlinePreview?url="+encodeURIComponent(Base64.encode(n[i]));
        		var url = n[i];
        		$("#zlwjlink").append("<a href='"+url+"' target='_blank' >"+n[i]+"</a><br>");
        	}
        	
        	// 多图上传
	       $("#multipleFile").fileinput({
	           uploadUrl: "/common/uploads",
	           uploadAsync: false,
	           showClose: false,
	           showCancel: false,
	           dropZoneEnabled: false,
	           buttonLabelClass: ''
	       }).on('filebatchuploadsuccess', function (event, data, previewId, index) {
	       	var rsp = data.response;
	           log.info("reutrn fileNames：" + rsp.fileNames)
			   $("#zilwj").val(rsp.fileNames);
	       }).on('fileremoved', function (event, id, index) {
	           $("input[name='" + event.currentTarget.id + "']").val('')
	       })
	       
        });

      //选择用户level1
		function selectlevel1() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel1User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel1User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#yyzxshId").val(rows[0].userId);
            $("#yyzxsh").val(rows[0].userName);
            $("#yyzxshStr").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level2
		function selectlevel2() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel2User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel2User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#sbbmshId").val(rows[0].userId);
            $("#sbbmsh").val(rows[0].userName);
            $("#sbbmshStr").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level3
		function selectlevell3() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel3User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel3User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#xmfzrshId").val(rows[0].userId);
            $("#xmfzrsh").val(rows[0].userName);
            $("#xmfzrshStr").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level4
		function selectlevel4() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel4User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel4User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#hjshId").val(rows[0].userId);
            $("#hjsh").val(rows[0].userName);
            $("#hjshStr").val(rows[0].userName);
            $.modal.closeAll();
        }
    </script>
</body>
</html>